(function(moduleName){
  // 列表
  sugarcane.module[moduleName] = function(data){
    /*
    TEXT(112, "文本"), IMGTEXT(102, "图文"), BIGIMG(103, "大图"), THREEIMG(111, "三图"), ADVERT(113, "广告"),
    VIDEO(119, "视频"), VIDEO_BIGIMG(164, "视频大图"), THREE_TO_ONE_IMG(1031, "3:1图"),
    CAROUSEL(124, "轮播"), SPECIAL(303, "专题"), BRIEF_NEWS(158, "快电"), SCROLL_THEME(116, "滑动专题");
    */
    if (data.commentNum =='0') {
      var _commentNum = "";
    } else{
      var _commentNum = data.commentNum + '评论'; 
    };
    if (data['showType'] == '102') {

      var _obj = newGrapes["listitem102"].init({
        "title": data.title,
        "subleft1": _commentNum,
        "subleft2": data.publishTime,
        "subleft3": "",
        "subright1": "",
        "subright2": "",
        "subright3": "",
        "imgurl": data.listImgs[0] || ""
      });
    } else if (data['showType'] == '103') {
      var _obj = newGrapes["listitem103"].init({
        "title": data.title,
        "imgurl": data.listImgs[0] || "",
        "summary": data.summary || "",
        "subleft1": data.publishTime,
        "subleft2": "",
        "subleft3": "",
        "subright1": "",
        "subright2": "",
        "subright3": ""
      });
    } else if (data['showType'] == '111') {
      var _obj = newGrapes["listitem111"].init({
        "title": data.title,
        "imgurl": data.listImgs,
        "subleft1": data.publishTime,
        "subleft2": "",
        "subleft3": "",
        "subright1": "",
        "subright2": "",
        "subright3": ""
      });
    } else if (data['showType'] == '112') {
      var _obj = newGrapes["listitem112"].init({
        "title": data.title,
        "summary": data.summary || "",
        "subleft1": _commentNum,
        "subleft2": data.publishTime,
        "subleft3": "",
        "subright1": "",
        "subright2": "",
        "subright3": ""
      });
    } else if (data['showType'] == '113') {
      var _obj = newGrapes["listitem113"].init({
        "imgurl": data.listImgs,
        "tag": data.tag || "",
      });
    } else if (data['showType'] == '158') {
      var _obj = newGrapes["listitem112"].init({
        "title": data.content,
        "summary": "",
        "subleft1": data.publishTime,
        "subleft2": "",
        "subleft3": "",
        "subright1": "",
        "subright2": "",
        "subright3": ""
      });
    } else if (data['showType'] == '116') {
      var _obj = newGrapes["listitem102"].init({
        "title": data.title,
        "imgurl": data.listImgs,
        "summary": "",
        "subleft1": data.publishTime,
        "subleft2": "",
        "subleft3": "",
        "subright1": "",
        "subright2": "",
        "subright3": ""
      });
    } else if (data['showType'] == '119') {
      var _obj = newGrapes["listitem119"].init({
        "title": data.title,
        "imgurl": data.listImgs
      });
    } else if (data['showType'] == '164') {
      var _obj = newGrapes["listitem164"].init({
        "title": data.title,
        "imgurl": data.listImgs,
        "subleft1": data.publishTime,
        "subleft2": "",
        "subleft3": "",
        "subright1": "",
        "subright2": "",
        "subright3": ""
      });
    } else if (data['showType'] == '1031') {
      var _obj = newGrapes["listitem1031"].init({
        "title": data.title,
        "imgurl": data.listImgs,
        "summary": "",
        "subleft1": "",
        "subleft2": "",
        "subleft3": "",
        "subright1": "",
        "subright2": "",
        "subright3": ""
      });
    } else {
      // 其他未编列的格式用文本格式显示
      var _obj = newGrapes["listitem112"].init({
        "title": data.title,
        "summary": data.summary || "",
        "subleft1": data.commentNum || "",
        "subleft2": data.publishTime || "",
        "subleft3": "",
        "subright1": "",
        "subright2": "",
        "subright3": ""
      });
    }
    _obj.addClass('app-listitem');
    return _obj;
  };
  sugarcane.module['state'][moduleName] = 'load';
  sugarcane.module.callback(moduleName);
}("listitem"));